package org.vacoor.nothing.misc.express.usps.api.rate.v4;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

/**
 * USPS 费用计算响应
 *
 * @author vacoor
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "RateV4Response")
public class RateV4Response implements Iterable<RatePackage> {
    @XmlElement(name = "Package")
    private List<RatePackage> ratePackages;

    public List<RatePackage> getRatePackages() {
        return ratePackages;
    }

    public void setRatePackages(List<RatePackage> ratePackages) {
        this.ratePackages = ratePackages;
    }

    @Override
    public Iterator<RatePackage> iterator() {
        return null != ratePackages ? ratePackages.iterator() : Collections.<RatePackage>emptySet().iterator();
    }
}
